From: Keir Fraser Date: Mon, 2 Mar 2009 10:34:37 +0000 (+0000) Subject: xend: Fix removing /vm/UUID/device paths when device cannot be disconnected X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13995^2~24 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=8e3feb5145bbde1f01d001ce9574f67de87173f7;p=xen.git xend: Fix removing /vm/UUID/device paths when device cannot be disconnected Change deviceDestroy behavior to remove /vm/UUID/device/... path only when force was used (as it already does so for both frontend and backend) and do the removing from xen-hotplug-cleanup script when we are sure the device is really not attached to the guest any more. Signed-off-by: Jiri Denemark --- diff --git a/tools/hotplug/Linux/xen-hotplug-cleanup b/tools/hotplug/Linux/xen-hotplug-cleanup index f7337e45bf..b0798ee148 100644 --- a/tools/hotplug/Linux/xen-hotplug-cleanup +++ b/tools/hotplug/Linux/xen-hotplug-cleanup @@ -11,6 +11,13 @@ dir=$(dirname "$0") # This is pretty horrible, but there's not really a nicer way of solving this. claim_lock "block" +# split backend/DEVCLASS/VMID/DEVID on slashes +path_array=( ${XENBUS_PATH//\// } ) +# get /vm/UUID path +vm=$(xenstore-read "/local/domain/${path_array[2]}/vm") +# construct /vm/UUID/device/DEVCLASS/DEVID +vm_dev="$vm/device/${path_array[1]}/${path_array[3]}" + # remove device frontend store entries xenstore-rm -t \ $(xenstore-read "$XENBUS_PATH/frontend" 2>/dev/null) 2>/dev/null || true @@ -19,4 +26,7 @@ xenstore-rm -t \ xenstore-rm -t "$XENBUS_PATH" 2>/dev/null || true xenstore-rm -t "error/$XENBUS_PATH" 2>/dev/null || true +# remove device path from /vm/UUID +xenstore-rm -t "$vm_dev" 2>/dev/null || true + release_lock "block" diff --git a/tools/python/xen/xend/server/DevController.py b/tools/python/xen/xend/server/DevController.py index 67ca78ff79..6c2bb09ca6 100644 --- a/tools/python/xen/xend/server/DevController.py +++ b/tools/python/xen/xend/server/DevController.py @@ -235,8 +235,8 @@ class DevController: xstransact.Remove(backpath) xstransact.Remove(frontpath) - # xstransact.Remove(self.devicePath()) ?? Below is the same ? - self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev)) + # xstransact.Remove(self.devicePath()) ?? Below is the same ? + self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev)) def configurations(self, transaction = None): return map(lambda x: self.configuration(x, transaction), self.deviceIDs(transaction))